package com.beidasoft.flip.webframe.core.consts;

import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * <p>数字类型枚举</p>
* @author 肖翔
* @date 2019/12/05
*/
public enum NumTypeEnum {

    INT(), FLOAT(), DOUBLE(), SHORT(), LONG(), BIGINTEGER(), BIGDECIMAL();

    public static NumTypeEnum of(Class<?> clazz) {
        if (clazz == Integer.class) {
            return INT;
        }
        if (clazz == Float.class) {
            return FLOAT;
        }
        if (clazz == Double.class) {
            return DOUBLE;
        }
        if (clazz == Short.class) {
            return SHORT;
        }
        if (clazz == Long.class) {
            return LONG;
        }
        if (clazz == BigInteger.class) {
            return BIGINTEGER;
        }
        if (clazz == BigDecimal.class) {
            return BIGDECIMAL;
        }
        return null;
    }

}
